package com.hisysteTopet.hisystepet.controllerToSkip;

import com.hisysteTopet.hisystepet.controller.LoginController;
import com.hisysteTopet.hisystepet.interceptors.JWTInterceptor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ControllerToSkip {


    @RequestMapping("user")
    public ModelAndView user(){
        int viewInterceptors = LoginController.viewInterceptors;
        ModelAndView mav = new ModelAndView();
        if (viewInterceptors == 1){
            mav.setViewName("user/user");
        }else {
            mav.setViewName("error/4xx.html");
        }
        return mav;
    }

    @RequestMapping("admin")
    public ModelAndView admin(){
        int viewInterceptors = LoginController.viewInterceptors;
        ModelAndView mav = new ModelAndView();
        if (viewInterceptors == 2){
            mav.setViewName("admin/admin");
        }else {
            mav.setViewName("error/4xx.html");
        }
        return mav;
    }

    @RequestMapping("showIndent")
    public ModelAndView showIndent(){
        String username = JWTInterceptor.username;
        ModelAndView mav = new ModelAndView();
            mav.setViewName("user/showIndent");
        return mav;
    }

    @RequestMapping("file")
    public ModelAndView file(){
        ModelAndView mav = new ModelAndView();
        mav.setViewName("file/file");
        return mav;
    }

//    @RequestMapping("registration")
//    public ModelAndView registration(){
//        Boolean viewInterceptors = LoginController.viewInterceptors;
//        ModelAndView mav = new ModelAndView();
//        if (viewInterceptors){
//            mav.setViewName("user/registration");
//        }else {
//            mav.setViewName("error/4xx.html");
//        }
//        return mav;
//    }
}
